enum Environment { development, staging, production }

class ApiConfig {
  static Environment _environment = Environment.development;

  static void setEnvironment(Environment env) {
    _environment = env;
  }

  static String get baseUrl {
    switch (_environment) {
      case Environment.development:
        return 'https://jsonplaceholder.typicode.com';
      case Environment.staging:
        return 'https://staging.api.example.com';
      case Environment.production:
        return 'https://api.example.com';
      default:
        return 'https://jsonplaceholder.typicode.com';
    }
  }

  static Map<String, String> get defaultHeaders {
    return {
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'User-Agent': 'Flutter-App/1.0.0',
    };
  }

  static Duration get connectTimeout => const Duration(seconds: 10);
  static Duration get receiveTimeout => const Duration(seconds: 10);
  static Duration get sendTimeout => const Duration(seconds: 10);

  // 重试配置
  static int get maxRetries => 3;
  static Duration get retryInterval => const Duration(seconds: 1);
}

// csdn 博客：https://blog.csdn.net/community/home-api/v1/get-business-list?page=1&size=20&businessType=blog&orderby=&noMore=false&year=&month=&username=2501_94013144

// https://blog.csdn.net/community/home-api/v1/get-business-list?page=1&size=20&businessType=blog&username=2501_94013144

